﻿using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
using ConfigurationManager = System.Configuration.ConfigurationManager;

namespace MyProject.Entities.Config
{
    public class AppConfig
    {
        private static AppConfig instance;
        public string AppTitle
        {
            get
            {
                return Properties.Settings.Default?.AppTitle ?? "";
            }
        }

        public string? AdminLogin
        {
            get
            {
                return Properties.Settings.Default?.AdminLogin ?? null;
            }
        }

        public string? AdminPassword
        {
            get
            {
                return Properties.Settings.Default?.AdminPassword ?? null;
            }
        }
        public string? GetConnectionString
        {
            get
            {
                return ConfigurationManager.ConnectionStrings["MyProject.Properties.Settings.Connection"]?.ConnectionString ?? null;
            }
        }

        public static AppConfig getInstance()
        {
            if (instance == null)
            {
                instance = new AppConfig();
            }
                
            return instance;
        }
    }
}
